/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Main.java
 *
 * Created on Dec 1, 2011, 6:22:55 PM
 */
package GUI;

import GUI.jpQuanLyNguoiDung;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

/**
 *
 * @author Nlanh_BN
 */
public class FrmMain extends javax.swing.JFrame {

    /** Creates new form Main */
    public FrmMain() {
        initComponents();
       /* try {
            UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
        } catch (UnsupportedLookAndFeelException ex) {
            ex.printStackTrace();
        } catch (ClassNotFoundException ex) {
            ex.printStackTrace();
        } catch (IllegalAccessException ex) {
            ex.printStackTrace();
        } catch (InstantiationException ex) {
            ex.printStackTrace();
        }*/
        this.loadDefault();
    }
    public void loadDefault(){
        jPanel1.removeAll();
        jPDefault d=new jPDefault();
        jPanel1.add("Welcome",d);
        if(FrmLogin.status.compareToIgnoreCase("admin") != 0){
            jMenu7.setEnabled(false);
        }
        if(FrmLogin.status.compareToIgnoreCase("nhanvien") == 0){
              jMenu13.setEnabled(false); 
              jMenu15.setEnabled(false);
              jMenu20.setEnabled(false);
              jMenu21.setEnabled(false);
              jMenu12.setEnabled(false);
        }
        //if(Login.status != "admin")
            //btnUser.setVisible(false);
    }


    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JTabbedPane();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenu5 = new javax.swing.JMenu();
        jMenu6 = new javax.swing.JMenu();
        jMenu7 = new javax.swing.JMenu();
        jMenu2 = new javax.swing.JMenu();
        jMenu8 = new javax.swing.JMenu();
        jMenu9 = new javax.swing.JMenu();
        jMenu10 = new javax.swing.JMenu();
        jMenu11 = new javax.swing.JMenu();
        jMenu12 = new javax.swing.JMenu();
        jMenu19 = new javax.swing.JMenu();
        jMenu3 = new javax.swing.JMenu();
        jMenu13 = new javax.swing.JMenu();
        jMenu14 = new javax.swing.JMenu();
        jMenu15 = new javax.swing.JMenu();
        jMenu16 = new javax.swing.JMenu();
        jMenu4 = new javax.swing.JMenu();
        jMenu20 = new javax.swing.JMenu();
        jMenu21 = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setBackground(new java.awt.Color(0, 255, 255));

        jMenuBar1.setMargin(new java.awt.Insets(0, 10, 10, 0));

        jMenu1.setText("Hệ Thống");
        jMenu1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jMenu1MouseClicked(evt);
            }
        });

        jMenu5.setText("LogOut");
        jMenu5.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jMenu5MouseClicked(evt);
            }
        });
        jMenu5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenu5ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenu5);

        jMenu6.setText("Thay đổi Password");
        jMenu6.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jMenu6MouseClicked(evt);
            }
        });
        jMenu6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenu6ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenu6);

        jMenu7.setText("Quản Lý Người Dùng");
        jMenu7.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jMenu7MouseClicked(evt);
            }
        });
        jMenu7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenu7ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenu7);

        jMenuBar1.add(jMenu1);

        jMenu2.setText("Danh Mục");
        jMenu2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenu2ActionPerformed(evt);
            }
        });

        jMenu8.setText("DM Nhà Cung Cấp");
        jMenu8.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jMenu8MouseClicked(evt);
            }
        });
        jMenu8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenu8ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenu8);

        jMenu9.setText("DM Kho Hàng");
        jMenu9.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jMenu9MouseClicked(evt);
            }
        });
        jMenu2.add(jMenu9);

        jMenu10.setText("DM Hàng Hóa");
        jMenu10.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jMenu10MouseClicked(evt);
            }
        });
        jMenu2.add(jMenu10);

        jMenu11.setText("DM Chủng Loại");
        jMenu11.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jMenu11MouseClicked(evt);
            }
        });
        jMenu2.add(jMenu11);

        jMenu12.setText("DM Nhân Viên");
        jMenu12.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jMenu12MouseClicked(evt);
            }
        });
        jMenu2.add(jMenu12);

        jMenu19.setText("DM Khách Hàng");
        jMenu19.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jMenu19MouseClicked(evt);
            }
        });
        jMenu2.add(jMenu19);

        jMenuBar1.add(jMenu2);

        jMenu3.setText("Kho Hàng");

        jMenu13.setText("Quản Lý Nhập Hàng");
        jMenu13.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jMenu13MouseClicked(evt);
            }
        });
        jMenu3.add(jMenu13);

        jMenu14.setText("Quản Lý Xuất Hàng");
        jMenu14.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jMenu14MouseClicked(evt);
            }
        });
        jMenu14.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenu14ActionPerformed(evt);
            }
        });
        jMenu3.add(jMenu14);

        jMenu15.setText("Quản Lý Hàng Tồn Kho");
        jMenu15.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jMenu15MouseClicked(evt);
            }
        });
        jMenu3.add(jMenu15);

        jMenu16.setText("Thanh Toán");
        jMenu16.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jMenu16MouseClicked(evt);
            }
        });
        jMenu3.add(jMenu16);

        jMenuBar1.add(jMenu3);

        jMenu4.setText("Thống Kê");

        jMenu20.setText("TK Hàng Nhập Theo Tháng");
        jMenu20.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jMenu20MouseClicked(evt);
            }
        });
        jMenu4.add(jMenu20);

        jMenu21.setText("TK Hàng Xuất Theo Quý");
        jMenu21.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jMenu21MouseClicked(evt);
            }
        });
        jMenu4.add(jMenu21);

        jMenuBar1.add(jMenu4);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 775, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 501, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void jMenu6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu6ActionPerformed
// TODO add your handling code here:
    java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new FrmChangePass(new javax.swing.JFrame(), true).setVisible(true);
            }
        });

}//GEN-LAST:event_jMenu6ActionPerformed

private void jMenu6MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenu6MouseClicked
// TODO add your handling code here:
    FrmChangePass a = new FrmChangePass(new javax.swing.JFrame(), true);
    a.setVisible(true);
}//GEN-LAST:event_jMenu6MouseClicked

private void jMenu8MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenu8MouseClicked
// TODO add your handling code here:
    jPanel1.removeAll();
    jpNhaCungCap d = new jpNhaCungCap();
    jPanel1.add("Danh Muc Nha Cung Cap", d);
}//GEN-LAST:event_jMenu8MouseClicked

private void jMenu8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu8ActionPerformed
// TODO add your handling code here:
    jPanel1.removeAll();
    jpNhaCungCap d = new jpNhaCungCap();
    jPanel1.add("Danh Muc Nha Cung Cap", d);
}//GEN-LAST:event_jMenu8ActionPerformed

private void jMenu2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu2ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jMenu2ActionPerformed

private void jMenu1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenu1MouseClicked
// TODO add your handling code here:
    
    
}//GEN-LAST:event_jMenu1MouseClicked

private void jMenu7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu7ActionPerformed
// TODO add your handling code here:
    jPanel1.removeAll();
    jpQuanLyNguoiDung d = new jpQuanLyNguoiDung();
    jPanel1.add("Quản Lý Người Dùng", d);
}//GEN-LAST:event_jMenu7ActionPerformed

private void jMenu7MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenu7MouseClicked
// TODO add your handling code here:
  jPanel1.removeAll();
    jpQuanLyNguoiDung d = new jpQuanLyNguoiDung();
    jPanel1.add("Quản Lý Người Dùng", d);
}//GEN-LAST:event_jMenu7MouseClicked

private void jMenu5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu5ActionPerformed
// TODO add your handling code here:
        FrmLogin l=new FrmLogin();
        l.setVisible(true);
        this.dispose();
}//GEN-LAST:event_jMenu5ActionPerformed

private void jMenu9MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenu9MouseClicked
// TODO add your handling code here:
    jPanel1.removeAll();
    jpKho d = new jpKho();
    jPanel1.add("Danh Mục Kho Hàng", d);
}//GEN-LAST:event_jMenu9MouseClicked

private void jMenu10MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenu10MouseClicked
// TODO add your handling code here:
    jPanel1.removeAll();
    jpHangHoa d = new jpHangHoa();
    jPanel1.add("Danh Muc Hàng Hóa", d);
}//GEN-LAST:event_jMenu10MouseClicked

private void jMenu11MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenu11MouseClicked
// TODO add your handling code here:
    jPanel1.removeAll();
    jpChungLoai d = new jpChungLoai();
    jPanel1.add("Danh Mục Chủng Loại", d);
}//GEN-LAST:event_jMenu11MouseClicked

private void jMenu12MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenu12MouseClicked
// TODO add your handling code here:
    jPanel1.removeAll();
    jpNhanVien d = new jpNhanVien();
    jPanel1.add("Danh Mục Nhân Viên", d);
}//GEN-LAST:event_jMenu12MouseClicked

private void jMenu13MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenu13MouseClicked
// TODO add your handling code here:
    jPanel1.removeAll();
    jpNhapHang d = new jpNhapHang();
    jPanel1.add("Quản Lý Nhập Hàng", d);
}//GEN-LAST:event_jMenu13MouseClicked

private void jMenu14ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu14ActionPerformed
// TODO add your handling code here:
    
}//GEN-LAST:event_jMenu14ActionPerformed

private void jMenu15MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenu15MouseClicked
// TODO add your handling code here:
    jPanel1.removeAll();
    jpTonKho d = new jpTonKho();
    jPanel1.add("Danh Mục Hàng Tồn Kho", d);
}//GEN-LAST:event_jMenu15MouseClicked

private void jMenu16MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenu16MouseClicked
// TODO add your handling code here:
    jPanel1.removeAll();
    jpThanhToan d = new jpThanhToan();
    jPanel1.add("Thanh Toán", d);
}//GEN-LAST:event_jMenu16MouseClicked

private void jMenu14MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenu14MouseClicked
// TODO add your handling code here:
    jPanel1.removeAll();
    jpXuatHang d = new jpXuatHang();
    jPanel1.add("Quản Lý Xuất Hàng", d);
}//GEN-LAST:event_jMenu14MouseClicked

private void jMenu19MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenu19MouseClicked
// TODO add your handling code here:
    jPanel1.removeAll();
    jpKhachHang d = new jpKhachHang();
    jPanel1.add("Danh Mục Khách Hàng", d);
}//GEN-LAST:event_jMenu19MouseClicked

private void jMenu20MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenu20MouseClicked
// TODO add your handling code here:
    jPanel1.removeAll();
    jpThongKePNTheoThang d;
        try {
            d = new jpThongKePNTheoThang();
            jPanel1.add("Thống Hàng Nhập Theo Tháng", d);
        } catch (SQLException ex) {
            Logger.getLogger(FrmMain.class.getName()).log(Level.SEVERE, null, ex);
        }
}//GEN-LAST:event_jMenu20MouseClicked

private void jMenu21MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenu21MouseClicked
        try {
            // TODO add your handling code here:
                jPanel1.removeAll();
                jpThongKePXTheoQuy a=new jpThongKePXTheoQuy();
                jPanel1.add("Thống Kê Hàng Xuất Theo Quí",a);
        } catch (SQLException ex) {
            Logger.getLogger(FrmMain.class.getName()).log(Level.SEVERE, null, ex);
        }
}//GEN-LAST:event_jMenu21MouseClicked

private void jMenu5MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenu5MouseClicked
// TODO add your handling code here:
        FrmLogin l=new FrmLogin();
        l.setVisible(true);
        this.dispose();
}//GEN-LAST:event_jMenu5MouseClicked

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(FrmMain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(FrmMain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(FrmMain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(FrmMain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new FrmMain().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu10;
    private javax.swing.JMenu jMenu11;
    private javax.swing.JMenu jMenu12;
    private javax.swing.JMenu jMenu13;
    private javax.swing.JMenu jMenu14;
    private javax.swing.JMenu jMenu15;
    private javax.swing.JMenu jMenu16;
    private javax.swing.JMenu jMenu19;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu20;
    private javax.swing.JMenu jMenu21;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenu jMenu4;
    private javax.swing.JMenu jMenu5;
    private javax.swing.JMenu jMenu6;
    private javax.swing.JMenu jMenu7;
    private javax.swing.JMenu jMenu8;
    private javax.swing.JMenu jMenu9;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JTabbedPane jPanel1;
    // End of variables declaration//GEN-END:variables
}
